﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.IO;

namespace 车牌识别
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {

            OpenFileDialog dialog = new OpenFileDialog();
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                pictureBox1.Load(dialog.FileName);
                               
            }         

            var client = new Baidu.Aip.Ocr.Ocr("EPsqvWUOu1vA5zeBQUlbTsM3", "PTUEQDXNDNoRC4M4sAc9VXHTGuyHPl9Q");
            var image = File.ReadAllBytes(dialog.FileName);
            var result = client.PlateLicense(image)["words_result"]["number"];
            

            textBox1.Text = result.ToString();
        }
    }
}
